package com.itheima.pattern.command;

import java.util.Map;

// 具体命令角色
public class OrderCommand implements Command {

    // 持有接收者对象
    private SeniorChef receiver;

    // 持有订单对象
    private Order order;

    public OrderCommand(SeniorChef receiver, Order order) {
        this.receiver = receiver;
        this.order = order;
    }

    @Override
    public void execute() {
        int diningTable = order.getDiningTable();
        System.out.println(diningTable + "桌的订单");

        Map<String, Integer> foodDir = order.getFoodDir();
        for (String foodName : foodDir.keySet()) {
            receiver.makeFood(foodName, foodDir.get(foodName));
        }

        System.out.println(diningTable + "桌的饭准备完毕！！！");
    }
}
